<template>
  <div class="w-full pb-80px text-14px" v-if="list.length > 0">
    <div class="p-20px bg-white border-b" v-for="item in list">
      <div class="flex w-full justify-between items-center">
        <div>{{ item.memo }}</div>
        <div class="text-[#0CB031]">
          <span v-show="item.price > 0">+</span>
          {{ item.price }}
        </div>
      </div>
      <div class="mt-15px flex w-full justify-between items-center">
        <div>{{ item.create_time }}</div>
        <div>余额：{{ item.yprice }}</div>
      </div>
    </div>
  </div>
  <div v-else class="mt-200px">
    <nodata></nodata>
  </div>
  <pagination
    @back="back"
    @next="next"
    :current_page="current_page"
    :last_page="last_page"
    :per_page="per_page"
    :total="total"
  ></pagination>
</template>
<script setup>
import pagination from "@/components/pagination.vue";
import { finance } from "@/util/api";
import nodata from "@/components/nodata.vue";
import { reactive } from "vue";
const current_page = ref(0);
const last_page = ref(0);
const per_page = ref(0);
const total = ref(0);
const list = ref([]);
const param = reactive({
  page: 1,
  type: 0, //资金明细
});
const getDate = async () => {
  const res = await finance(param);
  current_page.value = res.msg.current_page;
  last_page.value = res.msg.last_page;
  per_page.value = res.msg.per_page;
  total.value = res.msg.total;
  list.value = res.msg.data;
  //(res);
};
getDate();
const back = () => {
  param.page--;
  getDate();
};
const next = () => {
  param.page++;
  getDate();
};
</script>
